CREATE TABLE [dbo].[tb_DescuentosExternos]
(
[idDescuento] [int] NOT NULL IDENTITY(1, 1),
[Agente] [int] NOT NULL,
[EntidadExterna] [int] NOT NULL,
[Descripcion] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MontoTotal] [float] NOT NULL,
[MontoRemanente] [float] NOT NULL,
[CantidadCuotasMensuales] [int] NULL,
[UltMesLiquidacion] [int] NULL,
[UltCuotaDescontada] [int] NULL,
[FechaLimite] [datetime] NULL,
[Vigente] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[LiquidacionExterna] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_DescuentosExternos] ADD CONSTRAINT [PK_tb_DescuentosExternos] PRIMARY KEY NONCLUSTERED  ([idDescuento]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_DescuentosExternos] WITH NOCHECK ADD CONSTRAINT [FK_tb_DescuentosExternos_tb_Agentes] FOREIGN KEY ([Agente]) REFERENCES [dbo].[tb_Agentes] ([idAgente])
GO
ALTER TABLE [dbo].[tb_DescuentosExternos] ADD CONSTRAINT [FK_tb_DescuentosExternos_tb_EntidadesExternas] FOREIGN KEY ([EntidadExterna]) REFERENCES [dbo].[tb_EntidadesExternas] ([IdEntidad])
GO
